home *** CD-ROM | disk | FTP | other *** search
/ PC World 2008 March / PCWorld_2008-03_cd.bin / v cisle / mediacoder / MediaCoder-0.6.1.4045.exe / extensions / AudioRipper.7z / extension.xsl < prev   
Extensible Markup Language  |  2007-02-27  |  10KB  |  292 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3. <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  4.   <!--Include extension shared xsl-->
  5.   <xsl:include href="../_include/extbase.xsl"/>
  6.   <xsl:template match="/extension">
  7.     <html>
  8.     <head>
  9.     <title>MediaCoder <xsl:value-of select="name"/></title>
  10.     <link href="default.css" rel="stylesheet" type="text/css" />
  11.     <xsl:call-template name="InitExtension"/>
  12.     <script language="javascript">
  13.     var rate_mode = "VBR";
  14.     var target = "Lossy Formats";
  15.     function onElementChange(id,value)
  16.     {
  17.         switch (id) {
  18.         case "rate_mode":
  19.             rate_mode = value;
  20.             if (value == "VBR") {
  21.                 ShowItem("li_quality");
  22.                 HideItem("li_bitrate");
  23.             } else {
  24.                 HideItem("li_quality");
  25.                 ShowItem("li_bitrate");
  26.             }
  27.             break;
  28.         case "target":
  29.             target = value;
  30.             switch (value) {
  31.             case "Lossy Formats":
  32.                 HideItem("li_lossless");
  33.                 ShowItem("li_lossy");
  34.                 ShowItem("li_speed");
  35.                 onElementChange("rate_mode", rate_mode);
  36.                 onElementChange("lossy_formats", ValueOf("lossy_formats"));
  37.                 break;
  38.             case "Lossless Formats":
  39.                 HideItem("li_lossy");
  40.                 ShowItem("li_lossless");
  41.                 HideItem("li_quality");
  42.                 HideItem("li_bitrate");
  43.                 ShowItem("li_speed");
  44.                 onElementChange("lossless_formats", ValueOf("lossless_formats"));
  45.                 break;
  46.             case "Stream Copy":
  47.                 HideItem("li_lossy");
  48.                 HideItem("li_lossless");
  49.                 HideItem("li_quality");
  50.                 HideItem("li_bitrate");
  51.                 HideItem("li_speed");
  52.                 break;
  53.             }
  54.             break;
  55.         case "lossy_formats":
  56.             var fmt;
  57.             var profile = null;
  58.             switch (value) {
  59.             case "MP3":
  60.                 fmt = "LAME MP3";
  61.                 break;
  62.             case "Vorbis":
  63.                 fmt = "Vorbis";
  64.                 break;
  65.             case "LC-AAC":
  66.                 if (!profile) profile = "LC-AAC";
  67.             case "HE-AAC":
  68.                 if (!profile) profile = "HE-AAC";
  69.             case "HE-AAC V2":
  70.                 if (!profile) profile = "HE-AAC V2";
  71.                 fmt = "Nero Encoder";
  72.                 SetPrefValue("audioenc.nero.format", profile);
  73.                 break;
  74.             }
  75.             SetPrefValue("overall.audio.encoder", fmt);
  76.             SetBitrate(null);
  77.             SetSpeed();
  78.             break;
  79.         case "lossless_formats":
  80.             var fmt = value;
  81.             switch (value) {
  82.             case "Monkey's Audio (APE)":
  83.                 fmt = "APE"
  84.                 break;
  85.             }
  86.             SetPrefValue("overall.audio.encoder", fmt);
  87.             SetSpeed();
  88.             break;
  89.         case "speed":
  90.             SetSpeed();
  91.             break;
  92.         }
  93.     }
  94.     function element(id)
  95.     {
  96.         var e = document.getElementById(id);
  97.         if (e) return e;
  98.         alert("Element " + id + " not found");
  99.         return null;
  100.     }
  101.     function SetBitrate(value)
  102.     {
  103.         switch (ValueOf("lossy_formats")) {
  104.         case "MP3":
  105.             if (!value) {
  106.                 value = "128";
  107.                 element("bitrate").value = value;
  108.             }
  109.             SetPrefValue("audioenc.lame.bitrate", value);
  110.             break;
  111.         case "Vorbis":
  112.             if (!value) {
  113.                 value = "112";
  114.                 element("bitrate").value = value;
  115.             }
  116.             SetPrefValue("audioenc.vorbis.bitrate", value);
  117.             break;
  118.         case "LC-AAC":
  119.             if (!value) {
  120.                 value = "112";
  121.                 element("bitrate").value = value;
  122.             }
  123.             SetPrefValue("audioenc.nero.bitrate", value);
  124.             break;
  125.         case "HE-AAC":
  126.             if (!value) {
  127.                 value = "64";
  128.                 element("bitrate").value = value;
  129.             }
  130.             SetPrefValue("audioenc.nero.bitrate", value);
  131.             break;
  132.         case "HE-AAC V2":
  133.             if (!value) value = "48";
  134.             element("bitrate").value = value;
  135.             SetPrefValue("audioenc.nero.bitrate", value);
  136.             break;
  137.         }
  138.     }
  139.     function SetSpeed()
  140.     {
  141.         var speed = ValueOf("speed");
  142.         var fmt;
  143.         var info = "";
  144.         var map;
  145.         if (target == "Stream Copy")
  146.             fmt = "";
  147.         else
  148.             fmt = ValueOf(target == "Lossy Formats" ? "lossy_formats" : "lossless_formats");
  149.         switch (fmt) {
  150.         case "MP3":
  151.             map = new Array(0,2,4,6,9);
  152.             SetPrefValue("audioenc.lame.aq", map[speed]);
  153.             info = "LAME algorithm quality = " + map[speed];
  154.             break;
  155.         case "FLAC":
  156.             map = new Array(8,8,6,3,0);
  157.             SetPrefValue("audioenc.flac.level", map[speed]);
  158.             info = "FLAC compression level = " + map[speed];
  159.             if (speed == 0) {
  160.                 SetPrefValue("audioenc.flac.exhaustive", "true");
  161.                 info += ", exhaustive search enabled";
  162.             } else {
  163.                 SetPrefValue("audioenc.flac.exhaustive", "false");
  164.             }
  165.             break;
  166.         case "WavPack":
  167.             map = new Array(6,5,4,2,0);
  168.             SetPrefValue("audioenc.wavpack.extra", map[speed]);
  169.             info = "Extra encode processing = " + map[speed];
  170.             if (speed == 0 || speed == 1 || speed == 2) {
  171.                 SetPrefValue("audioenc.wavpack.best", "true");
  172.                 info += ", best compression mode enabled";
  173.             } else {
  174.                 SetPrefValue("audioenc.wavpack.best", "false");
  175.             }
  176.             break;
  177.         case "Monkey's Audio (APE)":
  178.             map = new Array("Insane","Extra High","High","Normal","Fast");
  179.             SetPrefValue("audioenc.ape.level", map[speed]);
  180.             info = "APE compression level = " + map[speed];
  181.             break;
  182.         default:
  183.             info = "No speed/quality trade-off option for this format";
  184.         }
  185.         element("speed_info").innerHTML = info;
  186.     }
  187.     function onLoad()
  188.     {
  189.         SetBitrate(null);
  190.         SetSpeed();
  191.     }
  192.     </script>
  193.     </head>
  194.     <body class="box1" onLoad="onLoad()">
  195.     <h2 align="center">MediaCoder <xsl:value-of select="name"/></h2>
  196.     <hr /><strong>Settings </strong><br />
  197.         <div style="border:solid">
  198.           <ul>
  199.               <li>
  200.                 Target:
  201.               <xsl:call-template name="AddElement">
  202.               <xsl:with-param name="element" select="elements/element[@id='target']"/>
  203.               <xsl:with-param name="option" select="elements/element[@id='target']/option[1]"/>
  204.             </xsl:call-template>
  205. (<a href="javascript:OpenURL('http://mediacoder.sourceforge.net/wiki/index.php?title=Lossy_data_compression')"><strong>?</strong></a>)
  206.               <xsl:call-template name="AddElement">
  207.               <xsl:with-param name="element" select="elements/element[@id='target']"/>
  208.               <xsl:with-param name="option" select="elements/element[@id='target']/option[2]"/>
  209.             </xsl:call-template>
  210. (<a href="javascript:OpenURL('http://mediacoder.sourceforge.net/wiki/index.php?title=Lossless_data_compression')"><strong>?</strong></a>)        
  211.               <xsl:call-template name="AddElement">
  212.               <xsl:with-param name="element" select="elements/element[@id='target']"/>
  213.               <xsl:with-param name="option" select="elements/element[@id='target']/option[3]"/>
  214.             </xsl:call-template>
  215.             </li>
  216.               <li id="li_lossy">Format:
  217.             <xsl:call-template name="AddElement">
  218.               <xsl:with-param name="element" select="elements/element[@id='lossy_formats']"/>
  219.             </xsl:call-template>
  220.             <xsl:call-template name="AddElement">
  221.               <xsl:with-param name="element" select="elements/element[@id='rate_mode']"/>
  222.               <xsl:with-param name="option" select="elements/element[@id='rate_mode']/option[1]"/>
  223.             </xsl:call-template>
  224.             <xsl:call-template name="AddElement">
  225.               <xsl:with-param name="element" select="elements/element[@id='rate_mode']"/>
  226.               <xsl:with-param name="option" select="elements/element[@id='rate_mode']/option[2]"/>
  227.             </xsl:call-template>
  228.               </li>
  229.               <li id="li_lossless"  style="display:none">Format:
  230.                 <xsl:call-template name="AddElement">
  231.                   <xsl:with-param name="element" select="elements/element[@id='lossless_formats']"/>
  232.                 </xsl:call-template>
  233.               </li>
  234.             <li id="li_quality">
  235.               Quality:
  236.                 <xsl:call-template name="AddElement">
  237.                   <xsl:with-param name="element" select="elements/element[@id='quality']"/>
  238.                 </xsl:call-template>
  239.             </li>
  240.             <li id="li_bitrate" style="display:none">
  241.               Bitrate:
  242.               <input type="text" size="4" value="128" id="bitrate" onkeyup="SetBitrate(value)"/> KBps
  243.             </li>
  244.             <li id="li_speed">
  245.               Speed/Quality Trade-off:
  246.                 <xsl:call-template name="AddElement">
  247.                   <xsl:with-param name="element" select="elements/element[@id='speed']"/>
  248.                 </xsl:call-template>
  249.                 <br /><div id="speed_info" style="font-style:italic"></div>
  250.             </li>
  251.           </ul>
  252.     </div>
  253.       <strong>  Filtering     </strong>
  254.       <div style="border:solid">
  255.         <ul>
  256. <li>Channels: 
  257.     <xsl:call-template name="AddElement">
  258.       <xsl:with-param name="element" select="elements/element[@id='channels']"/>
  259.     </xsl:call-template>
  260. </li>
  261. <li>Resampling:
  262.     <xsl:call-template name="AddElement">
  263.       <xsl:with-param name="element" select="elements/element[@id='resample']"/>
  264.       </xsl:call-template>
  265. </li>
  266. <li>Volume Gain: 
  267.     <xsl:call-template name="AddElement">
  268.       <xsl:with-param name="element" select="elements/element[@id='gain']"/>
  269.     </xsl:call-template>
  270. </li>
  271. <li>
  272.   <xsl:call-template name="AddElement">
  273.       <xsl:with-param name="element" select="elements/element[@id='normalize']"/>
  274.   </xsl:call-template>
  275.   <xsl:call-template name="AddElement">
  276.     <xsl:with-param name="element" select="elements/element[@id='extra_stereo']"/>
  277.   </xsl:call-template>
  278. </li>
  279. </ul>
  280.     </div>
  281.       <div align="center">
  282.       <p>
  283.           <input name="button" type="button" onclick="SendCommand('preview')" value="Play Original"/>
  284.           <input name="button" type="button" onclick="SendCommand('preview')" value="Play Encoded"/>
  285.         <input name="button" type="button" onclick="SendCommand('transcode')" value="Start Encoding"/>
  286.         </p>
  287.     </div>
  288.     </body>
  289.     </html>
  290.   </xsl:template>
  291. </xsl:stylesheet>
  292.